<?php
/**
 * File : LngListGenrator.php
 * Created by Ludovic Reenaers
 * Created on  9 nov. 2010
 * lreenaers@hotmail.com
 */
class LngListGenerator extends Generator{
	private $str;
	function setUp(){
		$dao = $this->Factory->getLangueDAO();
		$lngtab = $dao->getAllAvailable();
		$this->str = '<select name="lng" title="'.$this->translator->lngInfo.'" alt="'.$this->translator->lngInfo.'">';

		foreach ($lngtab as $Langue) {
			if($Langue->getIso() == $_SESSION['langue']){
				$this->str .= '<option value="'.$Langue->getId().'" SELECTED>'.$Langue->getLabel($_SESSION['langue']).'</option>';
			}else{
				$this->str .= '<option value="'.$Langue->getId().'">'.$Langue->getLabel($_SESSION['langue']).'</option>';
			}
		}
		$this->str .= "</select>";
	}
	function dump(){
		$this->setUp();
		return $this->str;
	}
}
?>